<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<style>
    canvas {
        width: 200px;
        height: 100px;
        border: solid 1px red;
    }
</style>

<body>
    <canvas id="myCanvas">

    </canvas>
    <script>
        var c = document.getElementById("myCanvas");
        var ctx = c.getContext("2d");
        //矩形

        ctx.beginPath();
        ctx.fillStyle = "#FF0000";
        ctx.fillRect(10, 10, 150, 75);
        ctx.stroke()
        // //画圆
        ctx.beginPath();
        ctx.arc(210,80, 40, 0, 2* Math.PI);
        ctx.stroke()
        
        // 等腰三角形
        ctx.beginPath();
        ctx.beginPath()
        ctx.moveTo(50,50)
        ctx.lineTo(200,10)
        ctx.lineTo(100,100)
        ctx.lineTo(50,50)
        ctx.stroke()
       
     
      
    </script>
</body>

</html>